<template>
	<view class="no-info-box">
		<view class="no-info-bg"><image :src="src"/></view>
		<view class="text">{{text}}</view>
		<view class="backButton" @click="back()" v-if="bottonType == '0'">
			 返回
		</view>
		<view class="backButton" @click="refresh()" v-else-if="bottonType == '1'">
			 刷新
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			text: {
				type: String,
				default: '暂无信息'
			},
			src: {
				type: String,
				default: '../../static/noData/no-data.png'
			},
			bottonType: {  //用于判断处理无数据返回，或网络异常刷新
				type: String,
				default: '-1'
			},
		},
		name: "defaultPage",
		data() {
			return {
			};
		},
		methods: {
			// 返回事件
			back(){
				uni.navigateBack()
			},
			// 刷新事件
			refresh(){
				this.$emit('refresh', true)
			}
		}
	}
</script>

<style lang="scss">
	/* 缺省页 */
	.no-info-box {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
	}

	.no-info-bg {
		margin-top: 80rpx;
		width: 394rpx;
		height: 394rpx;

		img {
			width: 100%;
			height: 100%;
		}
	}

	.text {
		width: 100%;
		text-align: center;
		padding: 40rpx 0;
		color: #AFAFAF;
		font-size: 30rpx;
	}
	// 返回按钮
	.backButton{
		margin: 0rpx auto;
		margin-top: 0;
		margin-bottom: 100rpx;
		border-radius: 30rpx;
		padding: 10rpx 45rpx;
		color: #FFFFFF;
		background: #1585FC;
	}
</style>
